﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Web.Mvc;

namespace AppManager.Model
{
    /// <summary>
    /// 不区分用户，因为菜单应该就是一套通用的
    /// </summary>
    public class Sys_User : BaseModel
    {
        /// <summary>
        /// 添加唯一索引,
        /// </summary>
        [Index(IsUnique = true)]
        [Column(TypeName = "varchar")]
        [MaxLength(100)]
        [Required] //1.这个属性既可以在Ef生成数据库时制定字段不为空，2.也可以在页面中的ModelState中检查用户输入是否为空
        public string LoginName { get; set; }
        [MaxLength(100)]
        [Required]
        public string LoginPwd { get; set; }
        [Required]
        public string Name { get; set; }
        /// <summary>
        /// 所分配的角色
        /// </summary>
        public int RoleId { get; set; }
        /// <summary>
        /// 该用户拥有的菜单集合
        /// </summary>
        [MaxLength(1000)]
        [AllowHtml]
        public string User_Menus { get; set; }



        [NotMapped]
        public Sys_Role Role { get; set; }
    }
}
